<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>参考资料卡片样式</title>
    <style>
        :root {
            --primary-color: #3498db;
            --secondary-color: #2c3e50;
            --light-bg: #f8f9fa;
            --dark-bg: #2c3e50;
            --light-text: #333;
            --dark-text: #f8f9fa;
            --card-shadow: 0 4px 8px rgba(0,0,0,0.1);
            --card-hover-shadow: 0 8px 16px rgba(0,0,0,0.15);
            --border-radius: 8px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: var(--light-bg);
            color: var(--light-text);
            padding: 20px;
            transition: background-color 0.3s, color 0.3s;
        }

        body.dark-theme {
            background-color: var(--dark-bg);
            color: var(--dark-text);
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        .header {
            text-align: center;
            margin-bottom: 40px;
        }

        .header h1 {
            margin-bottom: 10px;
            color: var(--primary-color);
        }

        .theme-toggle {
            background: none;
            border: 1px solid var(--primary-color);
            color: var(--primary-color);
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .theme-toggle:hover {
            background-color: var(--primary-color);
            color: white;
        }

        .cards-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 25px;
        }

        .reference-card {
            background-color: white;
            border-radius: var(--border-radius);
            box-shadow: var(--card-shadow);
            overflow: hidden;
            transition: transform 0.3s, box-shadow 0.3s;
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .dark-theme .reference-card {
            background-color: #34495e;
        }

        .reference-card:hover {
            transform: translateY(-5px);
            box-shadow: var(--card-hover-shadow);
        }

        .card-header {
            padding: 20px 20px 10px;
            border-bottom: 1px solid #eee;
        }

        .dark-theme .card-header {
            border-bottom: 1px solid #4a6278;
        }

        .card-title {
            font-size: 1.2rem;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--secondary-color);
            line-height: 1.4;
        }

        .dark-theme .card-title {
            color: #ecf0f1;
        }

        .card-url {
            font-size: 0.85rem;
            color: var(--primary-color);
            word-break: break-all;
            display: flex;
            align-items: center;
        }

        .card-url::before {
            content: "🔗";
            margin-right: 5px;
        }

        .card-body {
            padding: 15px 20px 20px;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
        }

        .card-description {
            color: #666;
            line-height: 1.5;
            margin-bottom: 15px;
            flex-grow: 1;
        }

        .dark-theme .card-description {
            color: #bdc3c7;
        }

        .card-link {
            display: inline-block;
            background-color: var(--primary-color);
            color: white;
            text-decoration: none;
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 0.9rem;
            text-align: center;
            transition: background-color 0.3s;
            align-self: flex-start;
        }

        .card-link:hover {
            background-color: #2980b9;
        }

        .footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            border-top: 1px solid #eee;
            color: #777;
            font-size: 0.9rem;
        }

        .dark-theme .footer {
            border-top: 1px solid #4a6278;
            color: #bdc3c7;
        }

        @media (max-width: 768px) {
            .cards-container {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <div class="header">
        <h1>参考资料卡片样式</h1>
        <p>统一的设计风格，清晰的信息层次</p>
        <button class="theme-toggle" id="themeToggle">切换到深色模式</button>
    </div>

    <div class="cards-container">
        <!-- 示例卡片 1 -->
        <div class="reference-card">
            <div class="card-header">
                <h3 class="card-title">MDN Web 文档 - CSS 参考</h3>
                <div class="card-url">https://developer.mozilla.org/zh-CN/docs/Web/CSS</div>
            </div>
            <div class="card-body">
                <p class="card-description">Mozilla Developer Network 提供的 CSS 技术文档，包含完整的 CSS 属性、选择器和概念说明，是前端开发者的必备参考资料。</p>
                <a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS" class="card-link" target="_blank">访问资源</a>
            </div>
        </div>

        <!-- 示例卡片 2 -->
        <div class="reference-card">
            <div class="card-header">
                <h3 class="card-title">React 官方文档</h3>
                <div class="card-url">https://reactjs.org/docs/getting-started.html</div>
            </div>
            <div class="card-body">
                <p class="card-description">React 是一个用于构建用户界面的 JavaScript 库。官方文档提供了完整的 API 参考、教程和最佳实践指南。</p>
                <a href="https://reactjs.org/docs/getting-started.html" class="card-link" target="_blank">访问资源</a>
            </div>
        </div>

        <!-- 示例卡片 3 -->
        <div class="reference-card">
            <div class="card-header">
                <h3 class="card-title">CSS-Tricks 网站</h3>
                <div class="card-url">https://css-tricks.com</div>
            </div>
            <div class="card-body">
                <p class="card-description">一个专注于前端开发技术的博客网站，提供大量 CSS 技巧、教程和最新前端技术动态，内容质量高且实用。</p>
                <a href="https://css-tricks.com" class="card-link" target="_blank">访问资源</a>
            </div>
        </div>

        <!-- 示例卡片 4 -->
        <div class="reference-card">
            <div class="card-header">
                <h3 class="card-title">GitHub 官方文档</h3>
                <div class="card-url">https://docs.github.com</div>
            </div>
            <div class="card-body">
                <p class="card-description">GitHub 的官方文档，涵盖了 Git 版本控制、GitHub 平台使用、团队协作和 CI/CD 等功能的详细说明。</p>
                <a href="https://docs.github.com" class="card-link" target="_blank">访问资源</a>
            </div>
        </div>
    </div>

    <div class="footer">
        <p>参考资料卡片样式设计 &copy; 2023</p>
    </div>
</div>

<script>
    // 主题切换功能
    const themeToggle = document.getElementById('themeToggle');
    themeToggle.addEventListener('click', function() {
        document.body.classList.toggle('dark-theme');

        if (document.body.classList.contains('dark-theme')) {
            themeToggle.textContent = '切换到浅色模式';
        } else {
            themeToggle.textContent = '切换到深色模式';
        }
    });
</script>
</body>
</html>